package de.schule.barnimgymnasium.javafx;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.chart.BarChart;
import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.scene.control.ScrollPane;
import javafx.scene.effect.DropShadow;
import javafx.scene.layout.TilePane;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class Widgets extends Application {

	@Override
	public void start(Stage primaryStage) throws Exception {
		ScrollPane scroll = new ScrollPane();
		TilePane pane = new TilePane();
		pane.prefColumnsProperty().setValue(2);
		// Text
		pane.getChildren().add(new Text("Text"));
		Text text = new Text("Einfacher Text");
		text.setFont(Font.font("Arial", 60));
		text.setEffect(new DropShadow(2, 3, 3, Color.RED));
		pane.getChildren().add(text);
		// Canvas
		pane.getChildren().add(new Text("Canvas"));
		Canvas canvas = new Canvas();
		// TODO: canvas.getGraphicsContext2D()...
		pane.getChildren().add(canvas);
		// BarChart
		pane.getChildren().add(new Text("BarChart"));
		final String austria = "Austria";
		final String brazil = "Brazil";
		final String france = "France";
		final String italy = "Italy";
		final String usa = "USA";
		final CategoryAxis xAxis = new CategoryAxis();
		final NumberAxis yAxis = new NumberAxis();
		final BarChart<String, Number> bc = new BarChart<String, Number>(xAxis,
				yAxis);
		bc.setTitle("Country Summary");
		xAxis.setLabel("Country");
		yAxis.setLabel("Value");

		XYChart.Series<String, Number> series1 = new XYChart.Series<String, Number>();
		series1.setName("2003");
		series1.getData().add(
				new XYChart.Data<String, Number>(austria, 25601.34));
		series1.getData().add(
				new XYChart.Data<String, Number>(brazil, 20148.82));
		series1.getData().add(new XYChart.Data<String, Number>(france, 10000));
		series1.getData()
				.add(new XYChart.Data<String, Number>(italy, 35407.15));
		series1.getData().add(new XYChart.Data<String, Number>(usa, 12000));

		XYChart.Series<String, Number> series2 = new XYChart.Series<String, Number>();
		series2.setName("2004");
		series2.getData().add(
				new XYChart.Data<String, Number>(austria, 57401.85));
		series2.getData().add(
				new XYChart.Data<String, Number>(brazil, 41941.19));
		series2.getData().add(
				new XYChart.Data<String, Number>(france, 45263.37));
		series2.getData().add(
				new XYChart.Data<String, Number>(italy, 117320.16));
		series2.getData().add(new XYChart.Data<String, Number>(usa, 14845.27));

		XYChart.Series<String, Number> series3 = new XYChart.Series<String, Number>();
		series3.setName("2005");
		series3.getData().add(
				new XYChart.Data<String, Number>(austria, 45000.65));
		series3.getData().add(
				new XYChart.Data<String, Number>(brazil, 44835.76));
		series3.getData().add(
				new XYChart.Data<String, Number>(france, 18722.18));
		series3.getData()
				.add(new XYChart.Data<String, Number>(italy, 17557.31));
		series3.getData().add(new XYChart.Data<String, Number>(usa, 92633.68));

		pane.getChildren().add(bc);
		//
		scroll.setContent(pane);
		primaryStage.setScene(new Scene(scroll));
		primaryStage.show();
	}

	public static void main(String[] args) {
		launch(args);

	}
}
